<?php
/**
 * Notes:
 * Created by PhpStorm.
 * Author: TS
 * Date: 2019/10/4
 * Time: 13:15
 */

namespace app\model;


use think\Model;

class Role extends Model
{

    public function add($data){
        $res = self::create($data);
        return $res;
    }
    public function del($role_id){
        return self::get($role_id)->delete();
    }
    public function edit($role_id,$data){
        return self::update($data,['role_id'=>$role_id]);
    }
    public function check($role_name){
        return self::get(['role_name' => $role_name]);
    }
    public function getById($role_id){
        return self::get([
            'role_id' => $role_id
        ]);
    }
    public function getAll(){
        return self::select();
    }

    public function getRoleAddTimeAttr($value){
        return date('Y-m-d H:i',$value);
    }


}